package com.stlm2.dems.dao.impl;

import org.springframework.stereotype.Repository;

import com.stlm2.dems.entity.ServiceOrder;
import com.stlm2.dems.dao.ServiceOrderDao;
import com.stlm2.core.base.impl.BaseDaoImpl;

import java.util.List;

@Repository("serviceOrderDao")
public class ServiceOrderDaoImpl extends BaseDaoImpl<ServiceOrder> implements ServiceOrderDao {

    @Override
    public List<ServiceOrder> findEntityByUserID(Integer userId) {
        return selectList("findEntityByUserID",userId);
    }

    //取消订单购买的增值服务
    @Override
    public void updateState(String goodsOrderCode) {
       update("updateState",goodsOrderCode);
    }

    @Override
    public List<ServiceOrder> getByGoodsOrderCode(String goodsOrderCode) {
        return selectList("getByGoodsOrderCode",goodsOrderCode);
    }

    @Override
    public Integer countByPurchaseOrderCode(String purchaseOrderCode) {
        return (Integer) _selectOne("countByPurchaseOrderCode",purchaseOrderCode);
    }

    @Override
    public Integer countByShopOrderCode(String shopOrderCode) {
        return (Integer) _selectOne("countByShopOrderCode",shopOrderCode);
    }

    @Override
    public Integer countByGoodsOrderCode(String goodsOrderCode) {
        return (Integer) _selectOne("countByGoodsOrderCode",goodsOrderCode);
    }
}